package com.labo.erpcrm.controleur;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.labo.erpcrm.metier.NouveauClientBusiness;

//@WebServlet("/NouveauClient")
public class NouveauClientControleur extends HttpServlet {

	private static final long serialVersionUID = 1L;
	private static final String VUE_NOUVEAUCLIENT = "/client-manager-add.jsp";
	protected NouveauClientBusiness nouveauClient;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		RequestDispatcher rd = null;
		HttpSession session = req.getSession();
		System.out.println("SESSION : "+session.getAttribute("current_user"));
		nouveauClient = new NouveauClientBusiness();
		nouveauClient.validateNewClient(req);
		rd = getServletContext().getRequestDispatcher(VUE_NOUVEAUCLIENT);
		req.setAttribute("nouveau_client", nouveauClient);
		rd.forward(req, resp);

	}

}
